package com.curtain.koreyoshi.view.widget;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.View;

/**
 * Created by leejunpeng on 2016/4/12.
 */
public class ArrowView extends View{
    private Paint paint;
    private Context context;

    public void setWidth(int width) {
        this.width = width;
        invalidate();
    }

    public void setHeight(int height) {
        this.height = height;
        invalidate();
    }

    private int width;
    private int height;
    public ArrowView(Context context) {
        super(context);
        this.context = context;
        this.paint = new Paint();
        this.paint.setAntiAlias(true); //消除锯齿
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        this.paint.setColor(Color.WHITE);
        this.paint.setStrokeWidth(6);
        int x1 = 0;
        int x2 = width/2;
        int x3 = width;
        int y1 = 0;
        int y2 = height/2;
        int y3 = height;
        canvas.drawLine(x1,y2,x2,y1,paint);
        canvas.drawLine(x1,y3,x2,y2,paint);
        canvas.drawLine(x2,y1,x3,y2,paint);
        canvas.drawLine(x2,y2,x3,y3,paint);
    }
}
